package com.tourismhengyang.impl;

import java.io.IOException;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.tourismhengyang.beans.PlaneTicket;
import com.tourismhengyang.beans.TrainTicket;
import com.tourismhengyang.biz.IPlaneTicketBiz;
import com.tourismhengyang.biz.ITrainTicketBiz;
import com.tourismhengyang.dao.DBAccess;

public class PlaneTicketBizImpl implements IPlaneTicketBiz{
private DBAccess db = new DBAccess();
	
	@Override
	public List<PlaneTicket> getPlaneTickets(PlaneTicket pt) {
		SqlSession session = null;
		List<PlaneTicket> result = null;
		try {
			session = db.getSqlSession();
			IPlaneTicketBiz planeTicketBiz = session.getMapper(IPlaneTicketBiz.class);
			result = planeTicketBiz.getPlaneTickets(pt);
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}

	@Override
	public PlaneTicket getOneTicket(PlaneTicket pt) {
		SqlSession session = null;
		PlaneTicket result = null;
		try {
			session = db.getSqlSession();
			IPlaneTicketBiz planeTicketBiz = session.getMapper(IPlaneTicketBiz.class);
			result = planeTicketBiz.getOneTicket(pt);
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}
}
